package com.mss.media.controller;


import com.mss.media.dto.AuditInstitutionsDTO;
import com.mss.media.dto.PageDTO;
import com.mss.media.service.IInstitutionsAuditListService;
import com.mss.media.util.ResultBody;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 用户机构审核列表  前端控制器
 * </p>
 *
 * @author runqiang
 * @since 2021-12-01
 */
@RestController
@CrossOrigin
@RequestMapping("/institutions-audit-list")
public class InstitutionsAuditListController {

    @Autowired
    private IInstitutionsAuditListService iInstitutionsAuditListService;

    /**
     * 查询机构审核列表
     *
     * @param dto 分页信息
     * @return 分页数据
     */
    @RequiresPermissions("admin:institutions-audit-list-find-page")
    @PostMapping("/find-page")
    public ResultBody findInstitutionsAuditPage(@RequestBody PageDTO dto) {
        return ResultBody.success(iInstitutionsAuditListService.findInstitutionsAuditPage(dto));
    }

    /**
     * 审核机构申请
     *
     * @param dto 审核信息
     * @param request 请求头
     * @return 状态
     */
    @RequiresPermissions("admin:institutions-audit-list-audit")
    @PostMapping("/audit")
    public ResultBody auditInstitutions(@RequestBody AuditInstitutionsDTO dto, HttpServletRequest request) {
        return ResultBody.success(iInstitutionsAuditListService.auditInstitutions(dto,request));
    }

}
